package com.ssn.proxy.image;

public class ImageProxy implements IShowImage {

    private Image image;
    private static Integer LEVEL;
    public ImageProxy(Image image) {
        if (this.image == null){
            this.image = image;
            LEVEL = 1;
        }
    }
    @Override
    public void showImage() {
        switch (LEVEL){
            case 1:
                image.smallImage();
                break;
            case 2:
                image.middleImage();
                break;
            case 3:
                image.originalImage();
                break;
        }
        image.showImage();
    }
    public void clickImage(){
        if (LEVEL == 1){
            image.load(2);
            LEVEL++;

        }
        showImage();
    }
    public void clickOrigin(){
        if (LEVEL == 2){
            image.load(3);
            LEVEL++;
        }
        showImage();
    }
}
